package ex.beans;

import java.util.HashMap;

/**
 * @program: LearShiroSpringMvc
 * @description:
 * @author: Mr.Dai
 * @create: 2020-03-27 14:33
 **/
public class DataDTO extends HashMap<String,Object> {

    // 0表示 返回成功  1 表示返回失败
    private Integer code;
    private Object message;

    public DataDTO(Integer code) {
        super.put("code",code);
    }

    public DataDTO(Integer code, Object message) {
       super.put("code",code);
       super.put("message",message);
    }

    public static DataDTO OK(){
        return new DataDTO(0);
    }
    public static DataDTO OK(Object message){
        return new DataDTO(0,message);
    }

    public static DataDTO ERROR(){
        return new DataDTO(1);
    }
    public static DataDTO ERROR(Object message){
        return new DataDTO(1,message);
    }

    @Override
    public DataDTO put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
